/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controller.web;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import business.DaftarUser;
import business.User;
import business.Obat;
import business.ObatListing;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpSession;

public class UserHome extends Servlet {
    private Obat obat;

    public UserHome() {
        super();
        setTemplate("/WEB-INF/UserHome.jsp");
    }

    @Override
    protected void process() {
          HttpSession session = getRequest().getSession();
          User user = new User();
          DaftarUser du = new DaftarUser();
          if(session.getAttribute("username") !=null){
              String username = (String) session.getAttribute("username");
              user = du.getUser(username);
          }else
          {
                try {
                    getResponse().sendRedirect("login");
                } catch (IOException ex) {
                    Logger.getLogger(UserHome.class.getName()).log(Level.SEVERE, null, ex);
                }
          }
         }

    private boolean validate_order(){
        ObatListing dl = new ObatListing();
        int xx = dl.getJumlahObat();

        if( xx == 0){
            return false;
        }
        return true;
        }
    }


